#ifndef VERTEXIRERATORS_H
#define VERTEXIRERATORS_H

#include "Graph.h"
#include "ConstraintIterator.h"
#include <boost/graph/graph_traits.hpp>
#include <boost/ref.hpp>

namespace SemanticModel
{
	class NodeIterator : public ConstraintIterator<boost::graph_traits<Graph>::vertex_iterator>
	{
	private:
		NodeType _type;
	public:
		NodeIterator(const Graph& g, PointerType p, PointerType pEnd, NodeType type)
			: ConstraintIterator<boost::graph_traits<Graph>::vertex_iterator>(g, p, pEnd)
		{
			_type = type;
		}
		
		const std::wstring& name()
		{
			const std::wstring& result =
					boost::get(boost::vertex_name, *_g)[*_p];
			return result;
		}

		NodeType type()
		{
			return bundle().type();
		}
		
	protected:
		const Node& bundle()
		{
			return (*_g)[*_p];
		}

		virtual const bool test()
		{
			NodeType type = bundle().type();
			return type == _type || _type == NoneNode;
		}
	};
}

#endif // VERTEXIRERATORS_H
